package net.itgoo.parkingpay.ui.orders;

import android.os.Bundle;

import net.itgoo.parkingpay.R;
import net.itgoo.parkingpay.vendor.mvp.ParkingMVPUtils;
import net.itgoo.parkingpay.vendor.widget.fragment.ParkingBaseFragment;

public class ParkingOrdersFragment extends ParkingBaseFragment {

    public static ParkingOrdersFragment newInstance() {
        return new ParkingOrdersFragment();
    }

    @Override
    protected int getLayoutResourceID() {
        return R.layout.parking_fragment_orders;
    }

    @Override
    protected void initUI(Bundle savedInstanceState) {
        initChildFragment();
    }

    @Override
    protected void initData(Bundle savedInstanceState) {

    }

    private void initChildFragment() {
        ParkingOrdersChildFragment fragment =
                (ParkingOrdersChildFragment) getChildFragmentManager().findFragmentById(R.id.parking_fragment_orders_content_fl);

        if (fragment == null) {
            fragment = ParkingOrdersChildFragment.newInstance(null);
            ParkingMVPUtils.addFragmentToActivity(getChildFragmentManager(),
                    fragment, R.id.parking_fragment_orders_content_fl);
        }

        new ParkingOrdersPresenter(null, fragment, new ParkingOrdersDataRepository());
    }
}
